﻿#region imports

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using CondeNet.AssetManager.Data;
using CondeNet.AssetManager.Business;
using CondeNet.AssetManager.Business.Interface;

#endregion

namespace CondeNet.AssetManager.DataProvider.Sql.Mappers
{
    public static class LanguageMapper
    {
        internal static ILanguage ToBusinessObject ( T_Language entity )
        {
            //if ( entity == null ) return new Language ( );

            return new Language (
                entity.Language_IDPK ,
                entity.Name_NVC ,
                entity.Description_NVC ,
                entity.LanguageCode_NVC ,
                entity.Enabled_BIT );
        }

        internal static T_Language ToEntity ( ILanguage v )
        {
            T_Language entity = new T_Language ( );

            entity.Language_IDPK = v.ID;
            entity.Name_NVC = v.Name;
            entity.Description_NVC = v.Description;
            entity.LanguageCode_NVC = v.LanguageCode;
            entity.Enabled_BIT = v.Enabled;

            return entity;
        }

        internal static IList<ILanguage> ToBusinessObjects ( IList<T_Language> dalList )
        {
            return dalList.Select ( tmp => ToBusinessObject ( tmp ) ).ToList ( );
        }

        internal static IList<T_Language> ToEntities ( IList<ILanguage> entityList )
        {
            return entityList.Select ( tmp => ToEntity ( tmp ) ).ToList ( );
        }
    }
}
